/**
 * 匠言知识付费v3.0.0
 * Author: 山西匠言网络科技有限公司
 * 这不是一个免费软件，它受限于许可条款，你可以访问https://www.zsfzxkc.cn/获取更多详细信息。
 * This is not a free software, it under the license terms, you can visit https://www.zsffzxkc.cn/ get more details.
 */
<template>
	<view>
		<view class="box">
			<view v-for="(item,index) in footerList" :key="index" class="nav" :class="[{newstyle1:mpsh,}]" @click="handleChangeCurrentPage(item)">
				<view class="itemtt" >
					<image class="icon-img" v-if="item.footer_ind !=4 || !has_notReadMsg" :src="current_ind == item.footer_ind?item.icon2:item.icon" mode="aspectFit"></image>
					<uni-badge :text="dot_text" v-if="item.footer_ind ==4 && has_notReadMsg==true" type='error' size="small" absolute="rightTop"><image class="icon-img" :src="current_ind == item.footer_ind?item.icon2:item.icon" mode="aspectFit"></image></uni-badge>
					<text class="texttt" :style="current_ind == item.footer_ind ? 'color:#fff' : 'color:#9e4206'">{{item.name}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"jy-navbar",
		props:['current_index'],
		data() {
			return {
				current_ind : this.current_index,
				footerList: [
					{
						icon: '/static/andy-ADTabbar/project2.png',
						icon2: '/static/andy-ADTabbar/project.png',
						name: '好项目',
						footer_ind: 1,
						page_route: '/pages/sidonghui/index',
						show:false,
					},{
						icon: '/static/andy-ADTabbar/meet2.png',
						icon2: '/static/andy-ADTabbar/meet.png',
						name: '私董会',
						footer_ind: 2,
						page_route: '/pages/sidonghui/chat',
						show:false,
					},{
						icon: '/static/andy-ADTabbar/pdata2.png',
						icon2: '/static/andy-ADTabbar/pdata.png',
						name: '个人资料',
						footer_ind: 3,
						page_route: '/pages/person-message/person-message',
						show:false,
					}
				],
				base_set:[],
				mpsh:false,
				dot_text:0,
				has_notReadMsg:false
			};
		},
		watch: {
		    current_index(newVal) {
				this.current_ind = newVal //对父组件传过来的值进行监听，如果改变也对子组件内部的值进行改变
		    }
		},
		created() {
			this.dot_text = getApp().globalData.dot_text;
			if(this.dot_text != 0){
				this.has_notReadMsg = true;
			}else{
				this.has_notReadMsg = false;
			}
			this.base_set = uni.getStorageSync('base_set');
			if(this.base_set.smallapp.is_sh == 1){
				this.mpsh = true
				this.footerList.splice(1,2);
			}
		},
		methods:{
			handleChangeCurrentPage(item) {
				uni.navigateTo({
					url: item.page_route
				})
			},
		}
	}
</script>

<style lang="less">
	.newstyle1{
		width: 33% !important;
	}
	.box{
		background: linear-gradient(90deg,#eca24d 0,#000 100%);
		z-index: 9999999;
		height: 110upx;
		width: 100%;
		position: fixed;
		bottom: 0;
		box-shadow: 0 -1px #eee;
		display: flex;
	}
	.current-page{
		color: #9e4206;
	}
	.nav{
		
		flex: 1;
		// float: left;
		height: 60upx;
	}
	.itemtt{
		height: 110upx;
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: space-around;
	}
	.icon-img{
		width: 50upx;
		height: 50upx;
	}
	.texttt{
		width: 100%;
		text-align: center;
		color: #ddd;
		font-size: 12px;
	}
</style>
